#ifndef GY68_H
#define GY68_H

#include <Wire.h> // For I2C communication
#include <math.h> // For pow() function

// Define types based on Arduino environment detection
#ifdef __AVR__
typedef uint8_t byte; // Use Arduino's byte type in AVR environment
#else
typedef unsigned char byte; // Use standard C++ type outside of AVR environment
#endif

#define BMP085_ADDRESS 0x77 // BMP180 I2C address

// Calibration coefficients
extern const unsigned char OSS;
extern int ac1;
extern int ac2;
extern int ac3;
extern unsigned int ac4;
extern unsigned int ac5;
extern unsigned int ac6;
extern int b1;
extern int b2;
extern int mb;
extern int mc;
extern int md;
extern long b5;

// Function prototypes
void bmp085Calibration();
float bmp085GetTemperature(unsigned int ut);
long bmp085GetPressure(unsigned long up);
char bmp085Read(unsigned char address);
int bmp085ReadInt(unsigned char address);
unsigned int bmp085ReadUT();
unsigned long bmp085ReadUP();
void writeRegister(int deviceAddress, byte address, byte val);
int readRegister(int deviceAddress, byte address);
float calcAltitude(float pressure);

#endif // GY68_H